package com.springboot.shanhexin.service;

import com.springboot.shanhexin.dao.touristDao;
import com.springboot.shanhexin.entity.tourist;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class touristService {

    @Autowired
    private touristDao touristDao;

    /**
     * 显示总数量
     * @return
     */
    public int getCount() {
        return touristDao.getCount();
    }

    /**
     * 全部分页显示
     * @return
     */
    public List<tourist> findByPage(int pos, int size) {
        return touristDao.findByPage(pos, size);
    }

    /**
     * 显示搜索的总数量
     * @return
     */
    public int getsearchCount(String key,String name) {
        return touristDao.getsearchCount(key,name);
    }

    /**
     * 搜索并分页显示
     * @return
     */
    public List<tourist> findsearchByPage(String key,String name,int pos, int size) {
        return touristDao.findsearchByPage(key,name,pos,size);
    }

    /**
     * 添加
     * @param
     */
    public void add(tourist tourist) {
        touristDao.add(tourist);
    }

    /**
     * 删除
     * @param id
     */
    public void delete(int id) {
        touristDao.delete(id);
    }

    /**
     * 修改(先找到并显示，再修改)
     * @param
     */
    public List<tourist> getUserone(int id) {
        return touristDao.getUserone(id);
    }
    public void update(tourist tourist) {
        touristDao.update(tourist);
    }

}
